import 'package:flutter/material.dart';
import 'package:flutter_app_unionad/ui/basice/base_navigation_widget.dart';
import 'package:core_package/core_package.dart';

// ignore: must_be_immutable
class UserCenterItem0Page extends StatelessWidget {
  static const String routeName = "/userCenterItem0Page";
  String date = "全部";
  final map;

  UserCenterItem0Page({Key? key, this.map}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return BaseNavigationWidget(
      title: '换芯记录',
      needScrollView: false,
      padding: EdgeInsets.only(left: 10.px, right: 10.px, bottom: 10.px + SizeFill.safeHeight!),
      child: Container(
        padding: EdgeInsets.symmetric(horizontal: 33.px, vertical: 40.px),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(5.px),
        ),
        child: buildContent(),
      ),
    );
  }

  Widget buildContent() {
    return Column(
      children: [
        buildSelectDate(),
        MySizeBox(height: 30.px),
        Expanded(child: buildListView()),
      ],
    );
  }

  Widget buildListView() {
    return ListView.builder(
        padding: EdgeInsets.zero,
        itemCount: 10,
        itemBuilder: (ctx, index) {
          return buildItem(index);
        });
  }

  Widget buildItem(int index) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 20.px),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: EdgeInsets.only(top: 16.px, bottom: 12.px),
            child: Text(
              "2020.12.29  北京市通州区",
              style: TextStyle(
                color: MyColors.formHex("#272727ff"),
                fontSize: MyFont.font13,
                fontWeight: MyFontWeight.regular,
              ),
            ),
          ),
          Divider(height: 1, color: MyColors.color_238_238_238),
        ],
      ),
    );
  }

  Widget buildSelectDate() {
    return Row(
      children: [
        MySizeBox(width: 30),
        Text(
          date,
          style: TextStyle(
            color: MyColors.formHex("#272727ff"),
            fontWeight: MyFontWeight.bold,
            fontSize: MyFont.font14,
          ),
        ),
        MySizeBox(width: 5),
        Icon(
          Icons.arrow_drop_down,
          size: 15.px,
        ),
      ],
    );
  }
}
